<template>
	<view>
		
		<view class="searchbox flex-between u-radius-50">
			<input type="text" v-model="searchWord" placeholder="按课程名称检索或者关键词检索"/>
			<view class="searchicon " @click="init()">
				<u-icon name='search' color='#fff' ></u-icon>
			</view>
		</view>
		
		
		<view class="lesson">
			<view class="lesson_item u-p-20 u-radius-10" @click="$goTo('/pagesT/jadetail/jadetail?id=' + i.id +'&index=' + index)" v-for="(i,index) in classlist" >
				<view class="flex-between u-p-tb-20">
					<text>课程名称</text>
					<text>{{i.code}}</text>
				</view>
				<u-line></u-line>
				<view class="flex-between u-p-tb-20">
					<text>发布者</text>
					<text>{{i.nickname}}</text>
				</view>
				<u-line></u-line>
				<view class="flex-between u-p-tb-20">
					<text>被引用次数</text>
					<text>{{i.refcount}}</text>
				</view>
				<u-line></u-line>
			</view>
			
			<u-empty v-if="classlist.length==0" ></u-empty>
		</view>
		<teachertabbar></teachertabbar>
	</view>
	
</template>

<script>
	import teachertabbar from '../../components/teachertabbar.vue';
	export default {
		components:{
			teachertabbar
		},
		data() {
			return {
				classlist:[],
				searchWord:'',
				loading:true
			};
		},
		onShow() {
			this.init()
			
		},
		onLoad() {
			setTimeout(()=>{
				this.loading = false
				console.log(this.loading);
			},2000)
		},
		onReachBottom() {
				
		},
		methods:{
			init(){
				this.$api.get('/assistant/xCourse/infoList',{
					searchWord:this.searchWord
				}).then(res=>{
					this.classlist = res.data
				})
			},
		}
	}
</script>

<style lang="scss">
.searchbox{
	border: 1rpx solid #999;
	box-sizing: border-box;
	width: 686rpx;
	margin: 30rpx auto;
	padding-left: 30rpx;
	input{
		flex: 1;
	}
	.searchicon{
		background-color: $main-color;
		padding: 30rpx;
		border-radius: 0 30rpx 30rpx 0;
	}
}
.lesson_item{
	width: 686rpx;
	box-sizing: border-box;
	margin: 30rpx auto;
	border: 1px solid rgba(0, 0, 0, 0.1);
}
</style>
